<template>
  <el-table :data="carContext" style="width: 100%">
    <el-table-column label="日期" width="180">
      <template slot-scope="scope">
        <i class="el-icon-time"></i>
        <span style="margin-left: 10px">{{ scope.row.createDate }}</span>
      </template>
    </el-table-column>
    <el-table-column label="求租者姓名" width="180">
      <template slot-scope="scope">
        <el-popover>
          <p>电话: {{ scope.row.userID.phone }}</p>
          <p>注册时间: {{ scope.row.userID.registeredTime }}</p>
          <div slot="reference" class="name-wrapper">
            <el-tag size="medium">{{ scope.row.userID.realName }}</el-tag>
          </div>
        </el-popover>
      </template>
    </el-table-column>
    <el-table-column label="评价内容" width="180">
      <template slot-scope="scope">
        <span style="margin-left: 10px">{{ scope.row.content }}</span>
      </template>
    </el-table-column>
    <el-table-column label="车辆信息" width="180">
      <template slot-scope="scope">
        <el-popover>
          <p>型号：{{ scope.row.carID.motorcycleType }}</p>
          <p>地址: {{ scope.row.carID.address }}</p>
          <p>座位：{{ scope.row.carID.seat }}</p>
          <p>车辆状态：{{ scope.row.carID.status }}</p>
          <p>注册时间: {{ scope.row.userID.registeredTime }}</p>
          <div slot="reference" class="name-wrapper">
            <el-tag size="medium">{{ scope.row.carID.address }}</el-tag>
          </div>
        </el-popover>
      </template>
    </el-table-column>
    <el-table-column label="订单信息" width="180">
      <template slot-scope="scope">
        <el-popover>
          <p>订单注册时间: {{ scope.row.orderID.createTime }}</p>
          <p>起始时间: {{ scope.row.orderID.startTime }}</p>
          <p>结束时间：{{ scope.row.orderID.endTime }}</p>
          <p>订单状态：{{ scope.row.orderID.status }}</p>
          <div slot="reference" class="name-wrapper">
            <el-tag size="medium">{{ scope.row.orderID.spentMoney }}</el-tag>
          </div>
        </el-popover>
      </template>
    </el-table-column>
    <el-table-column label="操作">
      <template slot-scope="scope">
        <el-button
          size="mini"
          type="danger"
          @click="handleDelete(scope.row._id)"
          >删除</el-button
        >
      </template>
    </el-table-column>
  </el-table>
</template>


<script>
import { createNamespacedHelpers } from "vuex";
const { mapState, mapActions } = createNamespacedHelpers("carComments");
export default {
  data() {
    return {};
  },
  created() {
    this.getCarComments();

    console.log("11111", this.carContext);
  },
  computed: {
    ...mapState(["carContext"]),
  },
  methods: {
    ...mapActions(["getCarComments", "deletCarComments"]),
    handleDelete(_id) {
      this.deletCarComments(_id);
      this.getCarComments();
    },
  },
};
</script>

<style>
</style>